package com.googlecode.antilopebpm.variable.converter;



import com.googlecode.antilopebpm.variable.VariableConverter;
import com.googlecode.antilopebpm.variable.instance.reference.ByteArray;

public class BytesToByteArrayConverter implements VariableConverter {

	private static final long serialVersionUID = 1L;

	public boolean supports(Object value) {
		if (value == null)
			return true;
		return (value.getClass() == byte[].class);
	}

	public Object convert(Object o) {
		return new ByteArray((byte[]) o);
	}

	public Object revert(Object o) {
		return ((ByteArray) o).getBytes();
	}

}
